package com.example.styconsumer.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.example.styinterface.interfaces.IRedisService;
import com.example.styinterface.utils.R;
import com.example.stymodel.model.Admin;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/redis")
public class RedisController {
    @Reference
    IRedisService redisService;
    @PostMapping("/insert/{key}/{value}")
    public R insertKey(@PathVariable("key") String key,@PathVariable("value")String value) {
        //todo 换成统一返回结果
        return redisService.insert(key,value);
    }
    @DeleteMapping("/delete/{key}")
    public R deleteKey(@PathVariable("key") String key) {
        return redisService.delete(key);
    }
    @GetMapping("/select/{key}")
    public R selectKey(@PathVariable("key") String key) {
        return redisService.selectKey(key);
    }
}
